package com.qianfeng.xiaxk.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by Administrator on 8/17/2015.
 *
 */
public class SingleViewPagerAdapter extends PagerAdapter {
    List<View> viewList;
    public SingleViewPagerAdapter(List<View> viewList){
        this.viewList = viewList;
    }
    @Override
    public int getCount() {
        return viewList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object obj) {
        return view == obj;
    }
    public void destroyItem(ViewGroup container, int position, Object object) {
        //super.destoryItem(container,positon,object);//不能留着
        container.removeView((View) object);

    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(viewList.get(position));
        return viewList.get(position);
    }

}
